package dao

import (
	"daily-blog/global"
	"daily-blog/model"
)

func CreateUser(user *model.User) error {
	return global.GVA_DB.Create(&user).Error
}
func GetUserByNamePwd(name, pwd string) (string, error) {
	var userId string
	err := global.GVA_DB.Model(&model.User{}).Select("user_id").First(&userId, "user_name=? and user_password=?", name, pwd).Error
	return userId, err
}
